package com.example.demo.niuke;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @Author: liull
 * @Description: 输入一个字符串。abcd12345
 * 输出：输出字符串中最长的数字字符串和它的长度。如果有相同长度的串，则要一块儿输出，但是长度还是一串的长度
 * @Date: Created in 16:56 2020/3/25
 * @Modified By:
 */
public class Main35 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
        while ((line = br.readLine()) != null) {
            List<String> list = new ArrayList<>();
            for (int i = 0; i < line.length(); i++) {
                if ('9' < line.charAt(i) || line.charAt(i) < '0') {
                    continue;
                }
                for (int j = i + 1; j < line.length(); j++) {
                    if (isDigit(line.substring(i, j))) {
                        if (j == line.length() - 1) {
                            list.add(line.substring(i, j + 1));
                            i = j;
                        }
                        continue;
                    } else {
                        list.add(line.substring(i, j - 1));
                        i = j-1;
                        break;
                    }
                }

            }
            Map<Integer, List<String>> collect = list.stream().collect(Collectors.groupingBy(String::length));
            Integer max = Collections.max(collect.keySet());
            List<String> strings = collect.get(max);
            for (String s : strings) {
                System.out.print(s);
            }
            System.out.println("," + max);
        }
    }

    private static boolean isDigit(String s) {
        try {
            Integer.parseInt(s);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}
